package Chapter8;
import java.io.*;
public class Example13 {
	public static void main(String[] args) throws Exception{
		Person p=new Person("p1","zhangsan",20);
		System.out.println("---before-----");
		System.out.println("person对象的age："+p.getAge());
		System.out.println("person对象的id："+p.getId());
		System.out.println("person对象的name："+p.getName());
		FileOutputStream fos=new FileOutputStream("objectStream.txt");
		ObjectOutputStream oos=new ObjectOutputStream(fos);
		oos.writeObject(p);
	}

}
class Person implements Serializable{
	private String id;
	private String name;
	private int age;
	public Person(String id,String name,int age) {
		super();
		this.id=id;
		this.name=name;
		this.age=age;
	}
	public String getId() {
		return id;
	}
	public String getName() {
		return name;
	}
	
	public int getAge() {
		return age;
	}
	
	
}